// import axios from 'axios'
// import { UniAdapter } from "uniapp-axios-adapter";
// // 开发地址
import baseUrl from './config'

export const request = (options) =>{
	console.log("options===>",options);
	return new Promise((resolve,reject)=>{
		uni.request({
			url:baseUrl + options.url,
			method:options.method || 'GET',
			data:options.data || {},
			header:{
				'Authorization':uni.getStorageSync('token')
			},
			success:(res)=>{
				if(res.statusCode && res.statusCode == 200){
					uni.showToast({
						title:"加载成功！"
					})
					resolve(res)
				}
				reject(res)
				
			},
			fail:(err)=>{
				console.log("报错了",err);
				reject(err)
			}
		})
	})
}